#!/usr/bin/python

__author__  = "firstinfobot at gmail dot com"
__version__ = (0,0,1)

"""
  Test Blogger
"""

from BloggerInterface import BloggerInterface
from BloggerInterface import BloggerTarget

def test_blog_is_ready(email, password):
    if email == None or password == None:
        print 'test_blog_is_ready'
        print '  first argument email: blogger user mail'
        print '  second argument password: blogger user password'
        raise ValueError('test_blog_is_ready: bad args')
    configuration = dict()
    configuration['blog_service'] = 'blogger'
    configuration['blog_user'] = email
    configuration['blog_password'] = password
    configuration['blog_source'] = 'athena_infobot (%s)' % repr(__version__)
    blog = BloggerInterface(configuration)
    if blog.is_ready():
       print 'blog.is_ready(): ok'
    else:
       print 'blog.is_ready(): error'
    target = BloggerTarget()
    blog.download(target)

def execute(argv):
   test_blog_is_ready(argv[0], argv[1])
    
import sys

if __name__ == "__main__":
   execute(sys.argv[1:])
